﻿Public Class XuLiHam

    Public Shared Sub NhapFullKiTu(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        If Char.IsNumber(e.KeyChar) And e.KeyChar = Chr(32) Then
            e.Handled = True
        End If
    End Sub

    Public Shared Sub NhapKiTu(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        '   nhap kí tự THƯỜNG                            '   nhập kí tự In HOA                                  ' các control : trừ sp
        If (e.KeyChar > Chr(64)) And (e.KeyChar < Chr(91)) Or (e.KeyChar > Chr(96)) And e.KeyChar < Chr(123) Or Char.IsControl(e.KeyChar) Then
            e.Handled = False
        Else
            e.Handled = True
            ' '''       MessageBox.Show("Chỉ nhập kí tự A,a-> Z,z", "Lỗi ", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

    Public Shared Sub ChiNhapSo(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        If Not Char.IsNumber(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
            e.Handled = True
            MessageBox.Show("Không được nhập ký tự!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning)
        End If
    End Sub


    Public Shared Sub KhoangTrang(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        If (e.KeyChar > Chr(64)) And (e.KeyChar < Chr(91)) Or (e.KeyChar > Chr(96)) And e.KeyChar < Chr(123) Or Char.IsControl(e.KeyChar) Or e.KeyChar = Chr(32) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    ' Hàm này dùng đẻ load Tháng lên ComboBox
    Public Shared Sub LoadThang(ByVal cbo As ComboBox)
        cbo.Items.Clear()
        For i = 0 To 12

            If i = 0 Then
                cbo.Items.Add("ALL")
            Else
                cbo.Items.Add(i)
            End If
        Next
        cbo.SelectedIndex = 0
    End Sub

End Class
